package com.xuelang.pipeline.app.resource;

import com.xuelang.pipeline.app.resource.impl.ArtifactToolServiceFallbackImpl;
import com.xuelang.pipeline.app.resource.request.ArtifactToolQuery;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.resource.dto.ArtifactToolDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author liuyuan.ly
 * @since 2024/8/16 16:03
 */
@FeignClient(name = "artifact-service", url = "${feign.rpc.artifactService}", fallbackFactory = ArtifactToolServiceFallbackImpl.class)
public interface ArtifactToolService {

    /**
     * 查询制品工具
     *
     * @param artifactToolUuid 制品工具UUID
     * @return
     */
    @GetMapping(value = "/get/{artifactToolUuid}", produces = "application/json;charset=utf-8")
    ApiResult<ArtifactToolDTO> queryArtifactTool(@PathVariable("artifactToolUuid") String artifactToolUuid);

    /**
     * 根据类型查询所有制品仓库列表信息
     *
     * @param artifactType
     * @return
     */
    @PostMapping(value = "/withoutData/list/{type}", produces = "application/json;charset=utf-8")
    ApiResult<List<ArtifactToolDTO>> withoutDataArtifactToolList(@PathVariable("type") String artifactType);


    /**
     * 查询制品工具列表(有过滤条件)
     *
     * @param artifactToolQuery 查询条件
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<ArtifactToolDTO>> conditionalArtifactToolList(@RequestBody ArtifactToolQuery artifactToolQuery);

}
